package o;

import android.content.Context;
import android.text.TextUtils;
import com.huawei.hms.support.api.entity.pay.HwPayConstant;
import com.huawei.hms.support.api.entity.pay.PayStatusCodes;
import org.json.JSONException;
import org.json.JSONObject;

public class fcv {
    private static void ˎ(String str, fcu o_fcu, Context context, String str2) {
        if (Logger.ˎ()) {
            Logger.ˏ("PayUtils", "checkPayReultInfo");
        }
        if (!TextUtils.isEmpty(str)) {
            if (avz.ˎ(str) == null) {
                String str3;
                if (TextUtils.isEmpty(str2)) {
                    str3 = "30000";
                    str2 = context.getString(exp$f.ˋʻ);
                } else {
                    str3 = str2;
                }
                avz.ˎ(str, ॱ(o_fcu, str3, str2));
            }
            avz.ˏ(str);
        }
    }

    private static Object ॱ(fcu o_fcu, String str, String str2) {
        try {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("returnCode", str);
            if (o_fcu == null) {
                jSONObject.put(HwPayConstant.KEY_USER_NAME, "");
                jSONObject.put(HwPayConstant.KEY_REQUESTID, "");
                jSONObject.put(HwPayConstant.KEY_AMOUNT, "");
            } else {
                jSONObject.put(HwPayConstant.KEY_USER_NAME, o_fcu.ॱ());
                jSONObject.put(HwPayConstant.KEY_REQUESTID, o_fcu.ॱॱ());
                jSONObject.put(HwPayConstant.KEY_AMOUNT, o_fcu.ˏ());
            }
            String str3 = "errMsg";
            if (str2 == null) {
                str2 = "";
            }
            jSONObject.put(str3, str2);
            jSONObject.put("time", String.valueOf(System.currentTimeMillis()));
            return jSONObject.toString();
        } catch (JSONException e) {
            Logger.e("PayUtils", "json error.");
            return "{\"" + "returnCode" + "\":\"" + PayStatusCodes.PAY_STATE_ERROR + "\"}";
        }
    }

    public static void ˋ(String str, fcu o_fcu, Context context, String str2) {
        if (Logger.ˎ()) {
            Logger.ˏ("PayUtils", "fininshedPayCallAction:" + str2);
        }
        ˎ(str, o_fcu, context, str2);
    }
}
